<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
  
    <link rel="stylesheet" type="text/css" href="/Public/admin/Css/bootstrap.min.css" />
     <link rel="stylesheet" type="text/css" href="/Public/admin/Css/ui.css" />
      <link rel="stylesheet" type="text/css" href="/Public/admin/Css/Admin-default.css" />
      
      <script type="text/javascript" src="/Public/Plugins/jquery/jquery-2.1.1.min.js"></script>
       <script type="text/javascript" src="/Public/Plugins/jquery/jquery-ui.js"></script>
   <script type="text/javascript" src="/Public/Plugins/bootstrap/bootstrap-datepicker.js"></script>
        <script type="text/javascript" src="/Public/Plugins/bootstrap/bootstrap.js"></script>
        <script type="text/javascript" src="/Public/Plugins/bootstrap/bootstrap-select.js"></script>
        <script type="text/javascript" src="/Public/Plugins/ui-frame/plugins.js"></script>
        <script type="text/javascript" src="/Public/Plugins/ui-frame/actions.js"></script>
        <script type="text/javascript" src="/Public/Plugins/dropzone/dropzone.js"></script>
        <script type="text/javascript" src="/Public/Plugins/knob/knob.js"></script>
        <script type="text/javascript" src="/Public/Js/Admin/questions-optionManager.js"></script>
   
</head>
<body>
<div class="page-content-wrap" style="height: 670px;">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                <form id="question-form" class="form-horizontal" action="<?php echo U('Questions/add', array('questionnaire_id'=>$questionnaire['id']));?>" method="post">

	<input type="hidden" name="questionnaire_id" value="<?php echo ($questionnaire["id"]); ?>">
	<input type="hidden" id="questionnaire_type" value="<?php echo ($questionnaire["type"]); ?>">

	<div class="form-group">
	    <blockquote class="blockquote-warning">
	        <h3><strong>添加问题</strong></h3>
	    </blockquote>
	</div>

	<div class="form-group">
	    <label class="col-md-1 col-xs-12 control-label">问题名称</label>
	    <div class="col-md-6 col-xs-12">                                            
	        <input name="name" type="text" class="form-control" value="<?php echo ($question["name"]); ?>" />
	    </div>
	</div>

	<div class="form-group">
	    <label class="col-md-1 col-xs-12 control-label">
	    	问题选项
	    </label>
	    <div class="col-md-7 col-xs-12 option-list">
	    	<?php if(is_array($optionsList)): $i = 0; $__LIST__ = $optionsList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i; switch($item["type"]): case "radio": ?><div class="option-item radio_option">
	    					<input name="-" type="radio" <?php if(isset($standardList[$i-1]))echo 'checked' ?> />
	    					<div>
	    						<input type="text" value="<?php echo ($item["text"]); ?>" class="form-control" placeholder="请输入选项文本" />
	    						<img class="option-del" src="/Public/Images/btn-del.png" title="删除该选项">
	    					</div>
	    				</div><?php break;?>

	    			<?php case "checkbox": ?><div class="option-item checkbox_option">
	    					<input type="checkbox" <?php if(isset($standardList[$i-1]))echo 'checked' ?> />
	    					<div>
	    						<input type="text" value="<?php echo ($item["text"]); ?>" class="form-control" placeholder="请输入选项文本" />
	    						<img class="option-del" src="/Public/Images/btn-del.png" title="删除该选项">
	    					</div>
	    				</div><?php break;?>

	    			<?php case "text": ?><div class="option-item text_option">
	    					<textarea class="form-control"><?php echo ($standardList); ?></textarea>
	    					<img class="option-del" src="/Public/Images/btn-del.png" title="删除该选项">
	    				</div><?php break;?>

	    			<?php case "radio_othertext": ?><div class="option-item radio_othertext_option">
	    					<input name="-" type="radio" <?php if(isset($standardList[$i-1]))echo 'checked' ?> />
	    					<div>
	    						<strong style="position: absolute;line-height: 25px;">其他：</strong>
	    						<input style="margin-left:40px;opacity: <?php if($questionnaire['type']=='exam')echo '1';else echo '0.3'; ?>;" type="text" class="form-control" value="<?php if(isset($standardList[$i-1]))echo $standardList[$i-1] ?>" <?php if($questionnaire['type']!='exam')echo 'disabled'; ?> />
	    						<img class="option-del" src="/Public/Images/btn-del.png" title="删除该选项">
	    					</div>
	    				</div><?php break;?>

	    			<?php case "checkbox_othertext": ?><div class="option-item checkbox_othertext_option">
	    					<input type="checkbox" <?php if(isset($standardList[$i-1]))echo 'checked' ?> />
	    					<div>
	    						<strong style="position: absolute;line-height: 25px;">其他：</strong>
	    						<input style="margin-left:40px;opacity: <?php if($questionnaire['type']=='exam')echo '1';else echo '0.3'; ?>;" type="text" class="form-control" value="<?php if(isset($standardList[$i-1]))echo $standardList[$i-1] ?>" <?php if($questionnaire['type']!='exam')echo 'disabled'; ?> />
	    						<img class="option-del" src="/Public/Images/btn-del.png" title="删除该选项">
	    					</div>
	    				</div><?php break; endswitch; endforeach; endif; else: echo "" ;endif; ?>
	    </div>

	    <?php if(($questionnaire["type"]) == "exam"): ?><input id="standard" name="standard" type="hidden" value='<?php echo ($question["standard"]); ?>' /><?php endif; ?>
	   	<input id="options" name="options" type="hidden" value='<?php echo ($question["options"]); ?>' />
	</div>

	<div class="form-group">
	    <label class="col-md-1 col-xs-12 control-label"></label>
	    <div class="col-md-2 col-xs-12">                                            
			<div class="btn-group">
			  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
				<span class="glyphicon glyphicon-plus"></span>
				添 加 选 项 
			  </button>				
			  <ul class="dropdown-menu alter-option-list" role="menu">
			    <li><a type="radio" class="btn" href="#"> 单 选 项 </a></li>
			    <li><a type="checkbox" class="btn" href="#"> 多 选 项 </a></li>
			    <li><a type="text" class="btn" href="#"> 文 本 输 入 </a></li>
			    <li><a type="radio_othertext" class="btn" href="#">单选其他 - 文本</a></li>
			    <li><a type="checkbox_othertext" class="btn" href="#">多选其他 - 文本</a></li>
			  </ul>
			</div>
	    </div>
	    <div class="col-md-6 col-xs-12">
	    	<em id="add-tip">考试卷请直接勾选或填入标准答案!</em>
	    </div>
        <?php if(isset($errorNote)): ?><div class="alert alert-danger" role="alert">
                <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <strong><?php echo ($errorNote); ?></strong>
            </div><?php endif; ?>	    
	</div>

	<div id="question-extendinfo">
		<?php if(($questionnaire["type"]) == "exam"): ?><div class="extend-row">
			    <label>分数</label> <input name="score" type="text" class="form-control" value="<?php echo ($question["score"]); ?>" />
			</div><?php endif; ?>

		<div class="extend-row">
		    <label>排序</label> <input name="sort" type="text" class="form-control" value="<?php echo ($question["sort"]); ?>" />
		</div>

		<div class="extend-row" style="background: none;">
		    <a id="submit" class="btn btn-info btn-block">提 交 问 题</a>
		</div>
	</div>

</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>